import Vue from 'vue'
import VueRouter from 'vue-router'
import ShouYe from '@/views/SouYe/index.vue'
import Register from '@/views/Register/index.vue'
import Login from '@/views/Login'
import Search from '@/views/Search/index.vue'
import Detail from '@/views/Detail/index.vue'
import MyShop from '@/views/MyShop/index.vue'
import ShopCar from '@/views/ShopCar/index.vue'
import ConfirmOrder from '@/views/ConfirmOrder/index.vue'

Vue.use(VueRouter)

const router = new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '/shouye',
      name: 'ShouYe',
      component: ShouYe
    },
    {
      path: '/search',
      name: 'Search',
      component: Search
    },
    {
      path: '/detail',
      name: 'Detail',
      component: Detail
    },
    {
      path: '/register',
      name: 'Register',
      component: Register,
      meta: {
        show: true
      }
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/myshop',
      name: 'MyShop',
      component: MyShop
    },

    {
      path: '/shopcar',
      name: 'ShopCar',
      component: ShopCar
    },
    {
      path: '/confirmOrder',
      name: 'ConfirmOrder',
      component: ConfirmOrder
    },
    {
      path: '/',
      redirect: '/shouye'
    }
  ],
  scrollBehavior() {
    return {
      x: 0,
      y: 0
    }
  }
})

export default router
